package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        //获取当前项目目录下所有子项
        File dir = new File(".");
        if (dir.isDirectory()){
            System.out.println(dir.getName()+":是一个目录");

            File[] subs = dir.listFiles();
            System.out.println(subs.length+"个子项");
            for (File sub : subs){
                System.out.println(sub.getName());
            }
        }
    }
}
